package com.nan.leetcode;

public class Test11 {
    public int removeElement(int[] nums, int val) {
        int x=0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != val){
                nums[x]=nums[i];
                x++;
            }
        }
        return x;
    }
    public static void main(String[] args) {
        Test11 test11 = new Test11();
        int[] array=new int[]{0,1,2,2,3,0,4,2};
        int y = test11.removeElement(array,2);
        System.out.println(y);
    }
}
